<template>
  <svg :class="svgClass" v-bind="$attrs" :style="{color: color,height:props.height+'px'}">
    <use :xlink:href="iconName" rel="external nofollow" />
  </svg>
</template>
  
<script lang="ts" setup>
const props = defineProps<{
  name: {
    type: String,
    required: true
  },
  color: {
    type: String,
    default: "red"
  },
  height: {
    type: String,
    default: '10'
  },
}>();

const iconName = computed(() => `#icon-${props.name}`);
const svgClass = computed(() => {
  // console.log(props.name, "props.name");
  if (props.name) {
    return `svg-icon icon-${props.name}`;
  }
  return "svg-icon";
});
</script>
  
  <style lang='scss'>
.svg-icon {
  width: 2.5em;
  height: 2em;
  // fill: currentColor;
  // vertical-align: middle;
  // background-color: aqua;
}
</style>
  